package com.highspeed.bdk.bean.entity.physical;

import com.bianmaba.spring.data.jpa.domain.annotations.QueryCacheable;
import com.highspeed.bdk.bean.base.IncrementEntity;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by chenjiabin on 2018/3/23.
 */
@Entity
@DynamicUpdate(true)
@DynamicInsert(true)
@QueryCacheable
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class PhysicalLink extends IncrementEntity {
    @Column(length = 32)
    private String physicalLinkID;

    @Column(length = 16)
    private String leftPort;

    @Column(length = 16)
    private String rightPort;

    @Column(length = 16)
    private String physicalLinkLinkStatus;

    @Column(length = 16)
    private String linkQuality;

    @Column(length = 16)
    private String BandwidthAvailable;

    @ManyToOne(optional = false)
    @JoinColumn(name = "leftCpu_Id")
    private Cpu leftCpu;

    @ManyToOne(optional = false)
    @JoinColumn(name = "rightCpu_Id")
    private Cpu rightCpu;

    @ManyToOne
    @JoinColumn(name = "physicalTopology_id")
    private PhysicalTopology physicalTopology;

    @OneToMany(mappedBy = "physicalLink", orphanRemoval = true)
    private List<LinkFoldPoint> foldPoints = new ArrayList<>(0);

    public List<LinkFoldPoint> getFoldPoints() {
        return foldPoints;
    }

    public void setFoldPoints(List<LinkFoldPoint> foldPoints) {
        this.foldPoints = foldPoints;
    }

    public String getPhysicalLinkID() {
        return physicalLinkID;
    }

    public void setPhysicalLinkID(String physicalLinkID) {
        this.physicalLinkID = physicalLinkID;
    }

    public String getPhysicalLinkLinkStatus() {
        return physicalLinkLinkStatus;
    }

    public void setPhysicalLinkLinkStatus(String physicalLinkLinkStatus) {
        this.physicalLinkLinkStatus = physicalLinkLinkStatus;
    }

    public String getLinkQuality() {
        return linkQuality;
    }

    public void setLinkQuality(String linkQuality) {
        this.linkQuality = linkQuality;
    }

    public String getBandwidthAvailable() {
        return BandwidthAvailable;
    }

    public void setBandwidthAvailable(String bandwidthAvailable) {
        BandwidthAvailable = bandwidthAvailable;
    }

    public Cpu getLeftCpu() {
        return leftCpu;
    }

    public void setLeftCpu(Cpu leftCpu) {
        this.leftCpu = leftCpu;
    }

    public Cpu getRightCpu() {
        return rightCpu;
    }

    public void setRightCpu(Cpu rightCpu) {
        this.rightCpu = rightCpu;
    }

    public String getLeftPort() {
        return leftPort;
    }

    public void setLeftPort(String leftPort) {
        this.leftPort = leftPort;
    }

    public String getRightPort() {
        return rightPort;
    }

    public void setRightPort(String rightPort) {
        this.rightPort = rightPort;
    }

    public PhysicalTopology getPhysicalTopology() {
        return physicalTopology;
    }

    public void setPhysicalTopology(PhysicalTopology physicalTopology) {
        this.physicalTopology = physicalTopology;
    }
}
